#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.


import random


def one_experiment():
    cnt = 0
    sum = 0

    while True:
        sum += int(random.random() * 10) + 1
        cnt += 1

        # if sum < 10:
            # print(">sum is ", sum)
        if sum >= 10:
            # print("cnt is ", cnt)
            # print("sum is ", sum)
            return cnt

def experiment():
    total_sum = 0
    expe_num = 10 ** 6        # 实验次数

    for i in range(expe_num):
        total_sum += one_experiment()

    avg = total_sum / expe_num
    print("avg ", avg)


def main():
    print("start main")
    experiment()

if __name__ == "__main__":
    main()
